package com.pay.h5.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;

import com.pay.service.IBaseInfoService;
import com.pay.service.IMerchantService;
import com.pay.service.IOrderService;
import com.pay.service.IProductService;


@Controller
public class TestController {

	@Autowired
	private IProductService productService ;
	
	@Autowired
	private IBaseInfoService baseInfoService ;
	
	@Autowired
	private IOrderService orderService ;
	
	@Autowired
	private IMerchantService merchantService ;
	
	/*@ResponseBody
	@RequestMapping(value="/test")
	public ResponseData test() {
		List<Order> orderList = orderService.list(null);
		for (Order order : orderList) {
			Merchant merchant = merchantService.getById(order.getMerchantId());
			BigDecimal amount = FunctionUtils.div(new BigDecimal(order.getAmount()), new BigDecimal(100), 2) ;
			BigDecimal reward = FunctionUtils.mul(merchant.getScale(), amount, 2) ;
			BigDecimal tax = FunctionUtils.sub(amount, reward, 2) ;
			order.setMerchantAmount(FunctionUtils.mul(reward, new BigDecimal(100), 2).longValue());
			order.setTaxAmount(FunctionUtils.mul(tax, new BigDecimal(100), 2).longValue());
			orderService.updateById(order) ;
		}
		return ResponseData.ok() ;
	}*/
}
